{{ template "header" . }}

{{ define "ideaGrid" }}{{ range . }}
{{ with .Hole }}
    <a class="card {{ .CategoryColor }}" href="/{{ .ID }}" title="{{ .Name }} ({{ .Category }})">
{{ else }}
    {{ $class := "red" }}
    {{ if eq .Category "cheeevo" }}
        {{ $class = "green" }}
    {{ else if eq .Category "hole" }}
        {{ $class = "purple" }}
    {{ else if eq .Category "lang" }}
        {{ $class = "yellow" }}
    {{ end }}

    <a class="card {{ $class }}" href="//github.com/code-golf/code-golf/issues/{{ .ID }}" title="{{ .Title }}">
{{ end }}
        <h2 class=span>
            {{ with .Lang }}{{ svg .ID }}{{ end }}
            <span>{{ .Title }}</span>
        </h2>
        {{ svg "thumbs-up" }}
        {{ .ThumbsUp }}

        {{ with .Hole }}{{ svg .CategoryIcon }}{{ else }}<span></span>{{ end }}

        {{ svg "thumbs-down" }}
        {{ .ThumbsDown }}
    </a>
{{ end }}{{ end }}

<header id=page-header>
    <h1>Ideas</h1>
    <nav>
        <a href="//github.com/code-golf/code-golf/issues/new/choose">
            Add an Idea
        </a>
    </nav>
</header>

<main>
{{ with .Data.Holes }}
    <details open>
        <summary>Experimental Holes ({{ len . }})</summary>
        <div>{{ template "ideaGrid" . }}</div>
    </details>
{{ end }}
{{ with .Data.Langs }}
    <details open>
        <summary>Experimental Languages ({{ len . }})</summary>
        <div>{{ template "ideaGrid" . }}</div>
    </details>
{{ end }}
{{ with .Data.Ideas }}
    <details open>
        <summary>Other Ideas ({{ len . }})</summary>
        <div>{{ template "ideaGrid" . }}</div>
    </details>
{{ end }}
</main>

{{ template "footer" }}
